<template>
	<view>
		
		
		<view class="mainContent">
			<div class="main">
					<div class="content">
						<view class="title"><text style="padding-left: 10px;">发布新帖>></text></view>
						<view class="item">
							<text>APP名字</text><input maxlength="15" v-model="LUNTAN_BIAOTI" class="inputView"
								placeholder="请输入标题" />
						</view>
						<view class="item">
							<text>微信号码</text><input maxlength="20" v-model="wxhm" class="inputView" placeholder="请输入微信号码" />
						</view>
						<view class="item">
							<text>QQ号码</text><input maxlength="20" v-model="qqhm" class="inputView" placeholder="请输入QQ号码" />
						</view>
						
						<view class="item">
							<text>帖子类型</text>
							<select class="inputView" v-model="tiezi_type">
								<option value="1">产品</option>
								<option value="2">渠道</option>
							</select>
						</view>
						<view class="item">
							<text>回复可见</text>
							<select class="inputView" v-model="need_huifu">
								<option value="0">否</option>
								<option value="1">是</option>
							
							</select>
						</view>
			
						<view class="item">
							<text>帖子详情</text><textarea v-model="LUNTAN_NEIRONG" class="inputContent" placeholder="请输入帖子详情" />
						</view>
						<a class="item1_button" @click="addTiezi()">确定发布</a>
			
					</div>
				</div>
			
			</div>
			
		</view>
	</view>
</template>

<script>
	
	
	export default {
		
		data() {
			return {
				LUNTAN_BIAOTI: null,
				tiezi_type: 1,
				qqhm: null,
				wxhm: null,
				need_huifu: 0,
				LUNTAN_NEIRONG: null,
			}
		},
		mounted() {
			
			
			
		},
		methods: {
			async addTiezi() {
				if(this.LUNTAN_BIAOTI==null){
					this.$Utils.showErrorToast("标题不能为空");
					return;
				}
				if(this.qqhm==null || this.wxhm==null){
					this.$Utils.showErrorToast("qq号码和微信号码必须填一个");
					return;
				}
				if(this.LUNTAN_NEIRONG==null || this.LUNTAN_NEIRONG.length<5){
					this.$Utils.showErrorToast("内容不能小于5个字");
					return;
				}
				try {
					const res = await this.$postData({
						url: this.$apis.addTiezi,
						data: {
							LUNTAN_BIAOTI: this.LUNTAN_BIAOTI,
							tiezi_type: this.tiezi_type,
							qqhm: this.qqhm,
							wxhm: this.wxhm,
							need_huifu: this.need_huifu,
							LUNTAN_NEIRONG: this.LUNTAN_NEIRONG,
							userName:this.$PublicData.getUserdata().userName,
							LUNTAN_APPUSERID:this.$PublicData.getUserdata().uid,
						}
					})
					
					uni.showToast({
						title: "发布成功",
						success:function(){
							uni.$emit('updateSize', 1);
							uni.navigateTo({
								url: '.luntan',
								
							})
						}
					})
			
				} catch (e) {
					console.log("eee: ", e);
				}
			},
		}
	}
</script>

<style>
.main {
		
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.title {
		line-height: 45px;
		width: 100%;
		height: 45px;
		background: #E5E5E5;
		color: #000000;
	}

	.content {
		border: 1px solid #E5E5E5;
		align-items: center;
		flex-direction: column;
		width: 1200px;
		min-height: 700px;
		display: flex;
	}

	.item {
		margin-top: 10px;
		align-items: center;
		display: flex;
		min-height: 45px;
	}

	.inputView {
		padding-left: 10px;
		margin-left: 30px;
		height: 40px;
		width: 600px;
		border: 1px solid #E5E5E5;
	}

	.inputContent {
		text-align: start;
		padding-left: 10px;
		margin-left: 30px;
		height: 120px;
		width: 600px;
		border: 1px solid #E5E5E5;
	}

	.item1_button {
		letter-spacing: 0.2rem;
		margin-top: 0.8125rem;
		font-size: 1rem;
		width: 18.875rem;
		border: 0.0625rem solid #F99B15;
		border-radius: 0.3125rem;
		text-align: center;
		justify-content: center;
		align-items: center;
		display: flex;
		height: 2.5rem;
		background: #F99B15;
		color: #FFFFFF;
	}
</style>
